﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using Acms.Bll;

namespace Acms.AcmsControls.ContentControls.Admin
{
    public class TextAdminEdit : BaseAdminEdit<TextContentControlProperties>
    {
        protected override string GetCssClass
        {
            get { return "text"; }
        }

        private TextBox textBox = new TextBox();

        protected override void CreateChildControls()
        {
            textBox.TextMode = TextBoxMode.MultiLine;
            textBox.Columns = 150;
            textBox.Rows = 15;
            this.Controls.Add(textBox);
            base.CreateChildControls();
        }

        protected override void SaveToProperties(TextContentControlProperties properties, PostControl control)
        {
            if (properties != null)
            {
                properties.Text = textBox.Text;
            }
        }

        public override void PropertiesLoaded(TextContentControlProperties properties)
        {
            if (properties != null)
            {
                textBox.Text = properties.Text;
            }
        }
    }
}
